<template>
  <div class="app">
    <h1>{{ msg }}</h1>
   <School/>
   <Student/>

  </div>
</template>


<script>
// 1.一种组件间通信的方式，适用于任意组件间通信
// 2.使用步骤:
  // 1.安装pubsub: npm i pubsub-js
  // 2.引|入: import pubsub from 'pubsub-js'
// 3.接收数据: A组件想接收数据，则在A组件中订阅消息，订阅的回调留在A组件自身.methods()demo(data)f......}
// 。。。..
// mounted() f
// this.pid = pubsub.subscribe('xxx',this.demo) //订阅消息
// 4.提供数据: pubsub.publish('xxx',数据)
// 5.最好在beforeDestroy钩子中,用 PubSub.unsubscribe(pid)去<span style="color:red>取消订阅。</span>

    import Student from './components/Student'

    import School from './components/School'


    export default {
        name: 'App',
        components:{
          Student,School
        },data() {
          return {
            msg:"你好啊！！",
            studentName:""
          }
        }
    }
</script>
<style  lang="less">
.app{
  background-color: yellow;
  padding: 5px;
}
</style>